package com.pozu.new_retail.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.pozu.new_retail.dao.pay.wx.WXPrePayReturns;
import com.pozu.new_retail.dao.vo.OrderVo;
import com.pozu.new_retail.dao.model.Order;
import com.pozu.new_retail.dao.model.ShoppingCart;

public interface OrderService {
	
	public int queryOrderCountByMap(HashMap<String, Object> map);
	
	//public String queryCodeByUserId(long userId);
	
	/**
	 * 微信预支付订单
	 * @return
	 */
	public WXPrePayReturns wxAddOrder(Order order,String wx_AppId,String wx_MchId,String wx_MchKey) throws Exception;
	
	/**
	 * 根据商户订单号查询订单信息
	 * @param orderId
	 * @return
	 */
	public Order queryByOrderId(String orderId);
	
	/**
	 * 根据微信订单号查询订单信息
	 * @param prepayid
	 * @return
	 */
	public Order queryByPrepayId(String prepayId);
	
	/**
	 * 更新订单信息
	 * @param orderInfo
	 * @return
	 */
	public int updateOrder(Order order);
	
	/**
	 * 查询微信订单状态
	 * @param oi
	 * @return
	 */
	public int queryWXOrder(Order order,String wx_AppId,String wx_MchId,String wx_MchKey) throws Exception ;
	
	/**
	 * 处理微信支付回调
	 * @param callBackString
	 * @throws Exception
	 */
	public String wxCallBack(String callBackString) throws Exception ;
	/**
	 * 处理已经支付的订单
	 * @param order
	 */
	public void handlePayedOrder(Order order);
	
	/**
	 * 生成订单
	 * @param carts
	 * @param userId
	 * @param receiver
	 * @param phone
	 * @param address
	 * @param appId
	 * @param channelId
	 * @param code
	 * @param level
	 * @param codeDiscount
	 * @param expressMoney
	 * @param scores
	 * @return
	 */
	public Order saveOrder(List<ShoppingCart> carts,long userId,String receiver,String phone,String address,int appId,int channelId,String code,Integer level,Integer codeDiscount,double expressMoney,double scores);
	
	/***
	 * 查询订单列表
	 * @return
	 */
	public List<OrderVo> queryOrderList(Map<String, Object> map);
	/***
	 * 查询退款订单
	 * @return
	 */
	public List<OrderVo> queryRefundOrderList(Map<String, Object> map);
	
	/****
	 * 根据订单号查询某商品预订个数
	 * @param orderId
	 * @return
	 */
	public int queryCountByOrderId(String orderId);

}
